package com.alibaba.citrus.cr.mn.order.center.facade.function.convert;

import com.alibaba.citrus.cr.common.util.DateUtils;
import com.epoch.app.crb2btradecenter.model.dto.PageQuerySaleOrderDetailGroupRequest;
import com.epoch.app.mnordercenter.model.dto.ExchangeOrderAtomBatchQueryRequest;
import com.epoch.app.mnordercenter.model.dto.SalesOrderAtomPageQueryRequest;

public class PageQuerySaleOrderDetailCovert {

    public static PageQuerySaleOrderDetailGroupRequest covert(SalesOrderAtomPageQueryRequest pageRequest) {
        return PageQuerySaleOrderDetailGroupRequest.builder()
                .relationNo(pageRequest.getRelationNo())
                .fromSysList(pageRequest.getFromSysList())
                .businessType(pageRequest.getBusinessType())
                .bisUnitCodeList(pageRequest.getBusinessUnitCodeList())
                .orderChannelCodeList(pageRequest.getOrderChannelCodeList())
                .bizCodeList(pageRequest.getSalesOrderNoList())
                .bizCode(pageRequest.getSalesOrderNo())
                .preOrderNoList(pageRequest.getPreOrderNoList())
                .sourceOrderNoList(pageRequest.getSourceOrderNoList())
                .orderTypeCodeList(pageRequest.getSalesOrderTypeList())
                .channelCode(pageRequest.getBusinessChannelCode())
                .organizationCode(pageRequest.getSalesOrganizationCode())
                .productGroupCode(pageRequest.getProductGroupCode())
                .customerCode(pageRequest.getCustomerCode())
                .customerCodeList(pageRequest.getCustomerCodeList())
                .receiveAddressCode(pageRequest.getShipToPartyCode())
                .receiveAddressCodeList(pageRequest.getShipToPartyCodeList())
                .saleChannelCodeList(pageRequest.getSalesChannelCodeList())
                .departmentCodeList(pageRequest.getSalesDepartmentCodeList())
                .customerGrade(pageRequest.getCustomerGrade())
                .customerGroup(pageRequest.getCustomerGroup())
                .statusList(pageRequest.getStatusList())
                .customerExpectBeginDate(DateUtils.toMillisecondByTime(pageRequest.getExpectedDeliveryBeginDate()))
                .customerExpectEndDate(DateUtils.toMillisecondByTime(pageRequest.getExpectedDeliveryEndDate()))
                .deliveryMethodCodeList(pageRequest.getDeliveryMethodCodeList())
                .fulfillmentTypeCode(pageRequest.getFulfillmentTypeCode())
                .fulfillmentPriority(pageRequest.getFulfillmentPriority())
                .orderBizTag(pageRequest.getOrderBizTag())
                .remark(pageRequest.getNote())
                .creatorCode(pageRequest.getCreatorCode())
                .modifierCode(pageRequest.getModifierCode())
                .gmtBeginCreate(DateUtils.toMillisecondByTime(pageRequest.getCreateBeginTime()))
                .gmtEndCreate(DateUtils.toMillisecondByTime(pageRequest.getCreateEndTime()))
                .gmtBeginModified(DateUtils.toMillisecondByTime(pageRequest.getModifyBeginTime()))
                .gmtEndModified(DateUtils.toMillisecondByTime(pageRequest.getModifyEndTime()))
                .customerPurchaseOrderNo(pageRequest.getCustomerPurchaseOrderNo())
                .orderReasonCodeList(pageRequest.getOrderReasonCodeList())
                .receiveWarehouseCodeList(pageRequest.getReceiveWarehouseCodeList())
                .scItemIdList(pageRequest.getProductCodeList())
                .deliveryFactoryCode(pageRequest.getDeliveryFactoryCode())
                .stockCode(pageRequest.getStockCode())
                .shippingWarehouseCodeList(pageRequest.getShippingWarehouseCodeList())
                .contact(pageRequest.getContact())
                .contactPhone(pageRequest.getContactPhone())
                .refuseReasonName(pageRequest.getCloseReason())
                .closed(pageRequest.getIsClose())
                .refuseReasonCodeList(pageRequest.getCloseReasonCodeList())
                .subRemark(pageRequest.getDetailNote())
                .start((pageRequest.getPage() - 1) * pageRequest.getSize())
                .limit(pageRequest.getSize())
                .orderCategoryCode(pageRequest.getOrderCategoryCode())
                .detailStatusList(pageRequest.getDetailStatusList())
                .mainSubStatusList(pageRequest.getReceiveStatusList())
                .subSubStatusList(pageRequest.getDetailReceiveStatusList())
                .sourceEndTime(pageRequest.getSourceEndTime())
                .sourceBeginTime(pageRequest.getSourceBeginTime())
                .kaAreaList(pageRequest.getKaAreaList())
                .kaSystemList(pageRequest.getKaSystemList())
                .outOrderNo(pageRequest.getOutOrderNo())
                .sourceOrderNo(pageRequest.getSourceOrderNo())
                .orderChannelCode(pageRequest.getOrderChannelCode())
                .orderCategoryCodeList(pageRequest.getOrderCategoryCodeList())
                .orderTag(pageRequest.getOrderTag())
                .outOrderNoList(pageRequest.getOutOrderNoList())
                .orderTagList(pageRequest.getOrderTagList())
                .fulfillmentStatusList(pageRequest.getFulfillmentStatusList())
                .giftFlag(pageRequest.getGiftFlag())
                .invoiceNo(pageRequest.getInvoiceNo())
                .fulfillmentMsg(pageRequest.getFulfillmentMsg())
                .build();
    }

    public static PageQuerySaleOrderDetailGroupRequest exchangeOrderAtomBatchQueryRequestCovert(ExchangeOrderAtomBatchQueryRequest pageRequest) {
        return PageQuerySaleOrderDetailGroupRequest.builder()
                .fromSys(pageRequest.getFromSys())
                .businessType(pageRequest.getBusinessType())
                .bisUnitCodeList(pageRequest.getBusinessUnitCodeList())
                .orderCategoryCode(pageRequest.getOrderCategoryCode())
                .orderChannelCodeList(pageRequest.getOrderChannelCodeList())
                .bizCode(pageRequest.getSalesOrderNo())
                .sourceOrderNoList(pageRequest.getSourceOrderNoList())
                .outOrderNoList(pageRequest.getOutOrderNoList())
                .orderTypeCodeList(pageRequest.getSalesOrderType())
                .channelCodeList(pageRequest.getBusinessChannel())
                .organizationCode(pageRequest.getSalesOrganizationCode())
                .productGroupCode(pageRequest.getProductGroupCode())
                .customerCode(pageRequest.getCustomerCode())
                .receiveAddressCode(pageRequest.getShipToPartyCode())
                .saleChannelCodeList(pageRequest.getSalesChannelCode())
                .departmentCodeList(pageRequest.getSalesDepartmentCode())
                .statusList(pageRequest.getStatusList())
                .customerExpectBeginDate(DateUtils.toMillisecondStr(pageRequest.getExpectedDeliveryBeginDate(), Boolean.TRUE))
                .customerExpectEndDate(DateUtils.toMillisecondStr(pageRequest.getExpectedDeliveryEndDate(), Boolean.FALSE))
                .deliveryMethodCodeList(pageRequest.getDeliveryMethodCodeList())
                .fulfillmentTypeCode(pageRequest.getFulfillmentTypeCode())
                .fulfillmentPriority(pageRequest.getFulfillmentPriority())
                .orderBizTag(pageRequest.getOrderBizTag())
                .remark(pageRequest.getNote())
                .creatorCode(pageRequest.getCreatorCode())
                .modifierCode(pageRequest.getModifierCode())
                .gmtBeginCreate(DateUtils.toMillisecondStr(pageRequest.getCreateTimeStart(), Boolean.TRUE))
                .gmtEndCreate(DateUtils.toMillisecondStr(pageRequest.getCreateTimeEnd(), Boolean.FALSE))
                .gmtBeginModified(DateUtils.toMillisecondStr(pageRequest.getModifyBeginTime(), Boolean.TRUE))
                .gmtEndModified(DateUtils.toMillisecondStr(pageRequest.getModifyEndTime(), Boolean.FALSE))
                .customerPurchaseOrderNo(pageRequest.getCustomerPurchaseOrderNo())
                .orderReasonCodeList(pageRequest.getOrderReasonCodeList())
                .shippingWarehouseCodeList(pageRequest.getShippingWarehouseCodeList())
                .deliveryFactoryCode(pageRequest.getDeliveryFactoryCode())
                .stockCode(pageRequest.getStockCode())
                .scItemIdList(pageRequest.getProductCodeList())
                .detailStatusList(pageRequest.getDetailStatusList())
                .subRemark(pageRequest.getDetailNote())
                .contact(pageRequest.getContact())
                .contactPhone(pageRequest.getContactPhone())
                .orderReasonCodeList(pageRequest.getOrderReasonCodeList())
                .build();
    }
}
